<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let p1 = new Promise((resolve, reject) => {
      // resolve('fulfilled')
      reject('rejected')
    })
    // p2 表示接收p1成功
    let p2 = p1.then(
      value => console.log(value), // 微
      reason => console.log(reason)
    ).then(
      a => console.log('成功'),
      b => console.log(b)
    );
    setTimeout(() => {
      console.log('setTimeout')
      console.log(p1)
      console.log(p2)
    })
    // console.log(p1) // 主
    // console.log(p2) // 主

    // 主任务完成后 轮询微任务 轮询宏任务
  </script>
</body>
</html>